package com.css.devops.domain;

import lombok.Getter;

/**
 * 构建状态
 */
@Getter
public enum BuildState {

	FINISHED("FINISHED", "已完成"),
	RUNNING("RUNNING", "构建中");

	/**
	 * 代码
	 */
	private String code;
	/**
	 * 名称
	 */
	private String name;

	BuildState(String code, String name) {
		this.code = code;
		this.name = name;
	}
	
	/**
	 * 根据类型获取BuildState
	 * @param result
	 * @return
	 */
	public static BuildState getBuildState(String result) {
		for(BuildState br : BuildState.values()) {
			if(br.getCode().equals(result)) {
				return br;
			}
		}
		return BuildState.FINISHED;
	}
}
